import java.text.SimpleDateFormat;
import java.util.Date;

public class Test10_priority {
    public static void main(String[] args) {
        ShowTime2 task=new ShowTime2();
        Thread stt=new Thread(task);
        stt.setPriority(10);
        stt.setName("线程1");
        stt.start();
        Thread t=new Thread(task,"线程2");
        t.setPriority(1);
        t.start();
    }
}
class ShowTime2 implements Runnable{
    @Override
    public void run() {
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy年mm月dd日 hh:mm:ss");
        Date d=null;
        while(true){
            d=new Date();
            System.out.println(Thread.currentThread().getName()+"当前的时间为："+sdf.format(d));

                try {
                    Thread.sleep(1000);
                } catch (InterruptedException e) {
                    e.printStackTrace();
                }
        }
    }
}
